package com.bms.common.bussiness.company.service.impl;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.bms.common.base.common.exception.BusinessException;
import com.bms.common.base.common.exception.EnumSvrResult;
import com.bms.common.bussiness.company.entity.Company;
import com.bms.common.bussiness.company.mapper.CompanyMapper;
import com.bms.common.bussiness.company.service.ICompanyService;

/**
 * <p>
 * 部门管理 服务实现类
 * </p>
 *
 * @author xj
 * @since 2018-09-03
 */
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {

	@Override
	public void saveApply(Company company) {
		String companyName = company.getName();
		if(this.selectCount(new EntityWrapper<Company>().eq("name", companyName.trim()))>0){
			throw new BusinessException(EnumSvrResult.REPEAT_COMPANY_NAME);
		}
		this.insert(company);
		
	}

}
